package main

import "fmt"

func AppendByte(slice []byte, data ...byte) []byte {

	m := len(slice)
	n := m + len(data)
	if n > cap(slice) { // if necessary, reallocate
		// allocate double what's needed, for future growth.
		newSlice := make([]byte, (n+1)*2)
		copy(newSlice, slice)
		slice = newSlice
	}
	slice = slice[0:n]
	copy(slice[m:n], data)

	return slice
}

func main2() {
	p := []byte{2, 3, 5}
	pp := []byte{8, 2, 3, 4, 5}

	p = append(p, pp...)
	fmt.Println(p)
	var ii []int
	fmt.Printf("%T -- %d -- %d\n", ii, len(ii), cap(ii))

	c := append([]byte{}, 3,4,5)
	fmt.Println(c)
	fmt.Printf("%T -- %d -- %d\n", c, len(c), cap(c))
	
	var d [0]int
	fmt.Println(d)
	
	sl := make([]byte,5)
	
	fmt.Println(sl)			
}
